Skip to content

Conversation

@lahsivjar
Copy link
Contributor

@lahsivjar lahsivjar requested a review from a team as a code owner August 13, 2024 15:15
Comment on lines +428 to +432
if p == 63 {
// p-value == 63 represents zero adjusted count
return 0.0
}
return math.Pow(2, float64(p))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[For reviewers] This is slightly different to what we do in apm-data (ref). In apm-data, the comment says that if p-value is invalid then it should have 1 rep count however, it's not true as a p-value==64 will result in rep count of 0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not true as a p-value==64 will result in rep count of 0.

I assume you meant p==63 as stated in https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling/#p-value

Copy link
Contributor Author

@lahsivjar lahsivjar Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you meant p==63 as stated in

Not quite. A p-value of 63 is a valid value, it represents a zero adjusted count (as per the specs you linked). OTOH, a p-value > 63 is invalid and should result in a rep count == 1 as per the comments in apm-data but the actual code in apm-data would give a rep count of 0 with p-value > 63

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Do you consider that a bug in apm-data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, the specs are a bit muddy around this so I don't think it would be a bug.

@lahsivjar lahsivjar requested a review from axw August 13, 2024 15:19
Comment on lines +428 to +432
if p == 63 {
// p-value == 63 represents zero adjusted count
return 0.0
}
return math.Pow(2, float64(p))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not true as a p-value==64 will result in rep count of 0.

I assume you meant p==63 as stated in https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling/#p-value

@lahsivjar lahsivjar merged commit 40b4fd9 into elastic:main Aug 13, 2024
@lahsivjar lahsivjar deleted the repcount branch August 13, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants